home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 November: Tool Chest / Dev.CD Nov 98 TC.toast / Tool Chest / Development Kits / MPW etc. / MPW-GM / Interfaces&Libraries / Interfaces / CIncludes / QD3D.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-02-17  |  40.7 KB  |  1,184 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        QD3D.h
  3.  
  4.      Contains:    Base types for Quickdraw 3D                            
  5.  
  6.      Version:    Technology:    Quickdraw 3D 1.5.4
  7.                  Release:    Universal Interfaces 3.1
  8.  
  9.      Copyright:    © 1995-1998 by Apple Computer, Inc., all rights reserved.
  10.  
  11.      Bugs?:        Please include the the file and version information (from above) with
  12.                  the problem description.  Developers belonging to one of the Apple
  13.                  developer programs can submit bug reports to:
  14.  
  15.                      devsupport@apple.com
  16.  
  17. */
  18. #ifndef __QD3D__
  19. #define __QD3D__
  20.  
  21. #ifndef __CONDITIONALMACROS__
  22. #include <ConditionalMacros.h>
  23. #endif
  24.  
  25. #if TARGET_OS_MAC
  26. #ifndef __MACTYPES__
  27. #include <MacTypes.h>
  28. #endif
  29. #endif  /* TARGET_OS_MAC */
  30.  
  31. #include <stdio.h>
  32.  
  33.  
  34. #if PRAGMA_ONCE
  35. #pragma once
  36. #endif
  37.  
  38. #ifdef __cplusplus
  39. extern "C" {
  40. #endif
  41.  
  42. #if PRAGMA_IMPORT
  43. #pragma import on
  44. #endif
  45.  
  46. #if PRAGMA_STRUCT_ALIGN
  47.     #pragma options align=power
  48. #elif PRAGMA_STRUCT_PACKPUSH
  49.     #pragma pack(push, 2)
  50. #elif PRAGMA_STRUCT_PACK
  51.     #pragma pack(2)
  52. #endif
  53.  
  54. #if PRAGMA_ENUM_ALWAYSINT
  55.     #pragma enumsalwaysint on
  56. #elif PRAGMA_ENUM_OPTIONS
  57.     #pragma option enum=int
  58. #elif PRAGMA_ENUM_PACK
  59.     #if __option(pack_enums)
  60.         #define PRAGMA_ENUM_PACK__QD3D__
  61.     #endif
  62.     #pragma options(!pack_enums)
  63. #endif
  64.  
  65. #if TARGET_OS_MAC
  66. #define OS_MACINTOSH 1
  67. #define OS_WIN32 0
  68. #define OS_UNIX 0
  69. #define OS_NEXT 0
  70. #define WINDOW_SYSTEM_MACINTOSH 1
  71. #define WINDOW_SYSTEM_WIN32 0
  72. #define WINDOW_SYSTEM_X11 0
  73. #define WINDOW_SYSTEM_NEXT 0
  74. #endif  /* TARGET_OS_MAC */
  75.  
  76. #if TARGET_OS_WIN32
  77. #define OS_MACINTOSH 0
  78. #define OS_WIN32 1
  79. #define OS_UNIX 0
  80. #define OS_NEXT 0
  81. #define WINDOW_SYSTEM_MACINTOSH 0
  82. #define WINDOW_SYSTEM_WIN32 1
  83. #define WINDOW_SYSTEM_X11 0
  84. #define WINDOW_SYSTEM_NEXT 0
  85. #endif  /* TARGET_OS_WIN32 */
  86.  
  87. #if TARGET_OS_UNIX
  88. #define OS_MACINTOSH 0
  89. #define OS_WIN32 0
  90. #define WINDOW_SYSTEM_MACINTOSH 0
  91. #define WINDOW_SYSTEM_WIN32 0
  92. #if NeXT
  93. #define OS_UNIX 0
  94. #define OS_NEXT 1
  95. #define WINDOW_SYSTEM_X11 0
  96. #define WINDOW_SYSTEM_NEXT 1
  97. #else
  98. #define OS_UNIX 1
  99. #define OS_NEXT 0
  100. #define WINDOW_SYSTEM_X11 1
  101. #define WINDOW_SYSTEM_NEXT 0
  102. #endif  /* NeXT */
  103.  
  104. #endif  /* TARGET_OS_UNIX */
  105.  
  106.  
  107. /******************************************************************************
  108.  **                                                                             **
  109.  **                                Export Control                                 **
  110.  **                                                                             **
  111.  *****************************************************************************/
  112. #if TARGET_OS_WIN32
  113.     #if defined(WIN32_EXPORTING)    /* define when building DLL */
  114.         #define QD3D_EXPORT __declspec( dllexport )     
  115.         #define QD3D_CALL    
  116.         #define QD3D_CALLBACK    
  117.     #else
  118.         #define QD3D_EXPORT __declspec( dllimport )    
  119.         #define QD3D_CALL    __cdecl
  120.         #define QD3D_CALLBACK    __cdecl    
  121.     #endif /* WIN32_EXPORTING */
  122. #else
  123.     #define QD3D_EXPORT
  124.     #define QD3D_CALL    
  125.     #define QD3D_CALLBACK    
  126. #endif  /*  TARGET_OS_WIN32  */
  127.  
  128.  
  129. /******************************************************************************
  130.  **                                                                             **
  131.  **                                NULL definition                                 **
  132.  **                                                                             **
  133.  *****************************************************************************/
  134.  
  135. #ifndef NULL
  136.     #error /*    NULL is undefined?    */
  137. #endif /* NULL */
  138.  
  139. /******************************************************************************
  140.  **                                                                             **
  141.  **                                    Objects                                     **
  142.  **                                                                             **
  143.  *****************************************************************************/
  144. /*
  145.  * Everything in QuickDraw 3D is an OBJECT: a bunch of data with a type,
  146.  * deletion, duplication, and i/o methods.
  147.  */
  148. #if TARGET_OS_MAC
  149. typedef FourCharCode                     TQ3ObjectType;
  150. #else
  151. typedef long                             TQ3ObjectType;
  152. #endif  /* TARGET_OS_MAC */
  153.  
  154. typedef struct OpaqueTQ3Object*         TQ3Object;
  155. /*
  156.  * There are four subclasses of OBJECT:
  157.  *    an ELEMENT, which is data that is placed in a SET
  158.  *    a SHAREDOBJECT, which is reference-counted data that is shared
  159.  *    VIEWs, which maintain state information for an image
  160.  *    a PICK, which used to query a VIEW
  161.  */
  162. typedef TQ3Object                         TQ3ElementObject;
  163. typedef TQ3Object                         TQ3SharedObject;
  164. typedef TQ3Object                         TQ3ViewObject;
  165. typedef TQ3Object                         TQ3PickObject;
  166. /*
  167.  * There are several types of SharedObjects:
  168.  *    RENDERERs, which paint to a drawContext
  169.  *    DRAWCONTEXTs, which are an interface to a device 
  170.  *    SETs, which maintains "mathematical sets" of ELEMENTs
  171.  *    FILEs, which maintain state information for a metafile
  172.  *    SHAPEs, which affect the state of the View
  173.  *    SHAPEPARTs, which contain geometry-specific data about a picking hit
  174.  *    CONTROLLERSTATEs, which hold state of the output channels for a CONTROLLER
  175.  *    TRACKERs, which represent a position and orientation in the user interface
  176.  *  STRINGs, which are abstractions of text string data.
  177.  *    STORAGE, which is an abstraction for stream-based data storage (files, memory)
  178.  *    TEXTUREs, for sharing bitmap information for TEXTURESHADERS
  179.  *    VIEWHINTs, which specifies viewing preferences in FILEs
  180.  */
  181. typedef TQ3SharedObject                 TQ3RendererObject;
  182. typedef TQ3SharedObject                 TQ3DrawContextObject;
  183. typedef TQ3SharedObject                 TQ3SetObject;
  184. typedef TQ3SharedObject                 TQ3FileObject;
  185. typedef TQ3SharedObject                 TQ3ShapeObject;
  186. typedef TQ3SharedObject                 TQ3ShapePartObject;
  187. typedef TQ3SharedObject                 TQ3ControllerStateObject;
  188. typedef TQ3SharedObject                 TQ3TrackerObject;
  189. typedef TQ3SharedObject                 TQ3StringObject;
  190. typedef TQ3SharedObject                 TQ3StorageObject;
  191. typedef TQ3SharedObject                 TQ3TextureObject;
  192. typedef TQ3SharedObject                 TQ3ViewHintsObject;
  193. /*
  194.  * There is one types of SET:
  195.  *    ATTRIBUTESETs, which contain ATTRIBUTEs which are inherited 
  196.  */
  197. typedef TQ3SetObject                     TQ3AttributeSet;
  198. /*
  199.  * There are many types of SHAPEs:
  200.  *    LIGHTs, which affect how the RENDERER draws 3-D cues
  201.  *    CAMERAs, which affects the location and orientation of the RENDERER in space
  202.  *    GROUPs, which may contain any number of SHARED OBJECTS
  203.  *    GEOMETRYs, which are representations of three-dimensional data
  204.  *    SHADERs, which affect how colors are drawn on a geometry
  205.  *    STYLEs, which affect how the RENDERER paints to the DRAWCONTEXT
  206.  *    TRANSFORMs, which affect the coordinate system in the VIEW
  207.  *    REFERENCEs, which are references to objects in FILEs
  208.  *  UNKNOWN, which hold unknown objects read from a metafile.
  209.  */
  210. typedef TQ3ShapeObject                     TQ3GroupObject;
  211. typedef TQ3ShapeObject                     TQ3GeometryObject;
  212. typedef TQ3ShapeObject                     TQ3ShaderObject;
  213. typedef TQ3ShapeObject                     TQ3StyleObject;
  214. typedef TQ3ShapeObject                     TQ3TransformObject;
  215. typedef TQ3ShapeObject                     TQ3LightObject;
  216. typedef TQ3ShapeObject                     TQ3CameraObject;
  217. typedef TQ3ShapeObject                     TQ3UnknownObject;
  218. typedef TQ3ShapeObject                     TQ3ReferenceObject;
  219. /*
  220.  * For now, there is only one type of SHAPEPARTs:
  221.  *    MESHPARTs, which describe some part of a mesh
  222.  */
  223. typedef TQ3ShapePartObject                 TQ3MeshPartObject;
  224. /*
  225.  * There are three types of MESHPARTs:
  226.  *    MESHFACEPARTs, which describe a face of a mesh
  227.  *    MESHEDGEPARTs, which describe a edge of a mesh
  228.  *    MESHVERTEXPARTs, which describe a vertex of a mesh
  229.  */
  230. typedef TQ3MeshPartObject                 TQ3MeshFacePartObject;
  231. typedef TQ3MeshPartObject                 TQ3MeshEdgePartObject;
  232. typedef TQ3MeshPartObject                 TQ3MeshVertexPartObject;
  233. /*
  234.  * A DISPLAY Group can be drawn to a view
  235.  */
  236. typedef TQ3GroupObject                     TQ3DisplayGroupObject;
  237. /*
  238.  * There are many types of SHADERs:
  239.  *    SURFACESHADERs, which affect how the surface of a geometry is painted
  240.  *    ILLUMINATIONSHADERs, which affect how lights affect the color of a surface
  241.  */
  242. typedef TQ3ShaderObject                 TQ3SurfaceShaderObject;
  243. typedef TQ3ShaderObject                 TQ3IlluminationShaderObject;
  244. /*
  245.  * A handle to an object in a group
  246.  */
  247. typedef struct OpaqueTQ3GroupPosition*     TQ3GroupPosition;
  248. /* 
  249.  * TQ3ObjectClassNameString is used for the class name of an object
  250.  */
  251.  
  252. enum {
  253.     kQ3StringMaximumLength        = 1024
  254. };
  255.  
  256. typedef char                             TQ3ObjectClassNameString[1024];
  257. /******************************************************************************
  258.  **                                                                             **
  259.  **                            Client/Server Things                             **
  260.  **                                                                             **
  261.  *****************************************************************************/
  262. typedef void *                            TQ3ControllerRef;
  263. /******************************************************************************
  264.  **                                                                             **
  265.  **                            Flags and Switches                                 **
  266.  **                                                                             **
  267.  *****************************************************************************/
  268.  
  269. enum TQ3Boolean {
  270.     kQ3False                    = 0,
  271.     kQ3True                        = 1
  272. };
  273. typedef enum TQ3Boolean TQ3Boolean;
  274.  
  275.  
  276. enum TQ3Switch {
  277.     kQ3Off                        = 0,
  278.     kQ3On                        = 1
  279. };
  280. typedef enum TQ3Switch TQ3Switch;
  281.  
  282.  
  283. enum TQ3Status {
  284.     kQ3Failure                    = 0,
  285.     kQ3Success                    = 1
  286. };
  287. typedef enum TQ3Status TQ3Status;
  288.  
  289.  
  290. enum TQ3Axis {
  291.     kQ3AxisX                    = 0,
  292.     kQ3AxisY                    = 1,
  293.     kQ3AxisZ                    = 2
  294. };
  295. typedef enum TQ3Axis TQ3Axis;
  296.  
  297.  
  298. enum TQ3PixelType {
  299.     kQ3PixelTypeRGB32            = 0,                            /* Alpha:8 (ignored), R:8, G:8, B:8    */
  300.     kQ3PixelTypeARGB32            = 1,                            /* Alpha:8, R:8, G:8, B:8             */
  301.     kQ3PixelTypeRGB16            = 2,                            /* Alpha:1 (ignored), R:5, G:5, B:5    */
  302.     kQ3PixelTypeARGB16            = 3,                            /* Alpha:1, R:5, G:5, B:5             */
  303.     kQ3PixelTypeRGB16_565        = 4,                            /* Win32 only: 16 bits/pixel, R:5, G:6, B:5        */
  304.     kQ3PixelTypeRGB24            = 5                                /* Win32 only: 24 bits/pixel, R:8, G:8, B:8        */
  305. };
  306. typedef enum TQ3PixelType TQ3PixelType;
  307.  
  308.  
  309. enum TQ3Endian {
  310.     kQ3EndianBig                = 0,
  311.     kQ3EndianLittle                = 1
  312. };
  313. typedef enum TQ3Endian TQ3Endian;
  314.  
  315.  
  316. enum TQ3EndCapMasks {
  317.     kQ3EndCapNone                = 0,
  318.     kQ3EndCapMaskTop            = 1 << 0,
  319.     kQ3EndCapMaskBottom            = 1 << 1,
  320.     kQ3EndCapMaskInterior        = 1 << 2
  321. };
  322. typedef enum TQ3EndCapMasks TQ3EndCapMasks;
  323.  
  324. typedef unsigned long                     TQ3EndCap;
  325. enum {    kQ3ArrayIndexNULL = ~0    };
  326. /******************************************************************************
  327.  **                                                                             **
  328.  **                        Point and Vector Definitions                         **
  329.  **                                                                             **
  330.  *****************************************************************************/
  331.  
  332. struct TQ3Vector2D {
  333.     float                             x;
  334.     float                             y;
  335. };
  336. typedef struct TQ3Vector2D                TQ3Vector2D;
  337.  
  338. struct TQ3Vector3D {
  339.     float                             x;
  340.     float                             y;
  341.     float                             z;
  342. };
  343. typedef struct TQ3Vector3D                TQ3Vector3D;
  344.  
  345. struct TQ3Point2D {
  346.     float                             x;
  347.     float                             y;
  348. };
  349. typedef struct TQ3Point2D                TQ3Point2D;
  350.  
  351. struct TQ3Point3D {
  352.     float                             x;
  353.     float                             y;
  354.     float                             z;
  355. };
  356. typedef struct TQ3Point3D                TQ3Point3D;
  357.  
  358. struct TQ3RationalPoint4D {
  359.     float                             x;
  360.     float                             y;
  361.     float                             z;
  362.     float                             w;
  363. };
  364. typedef struct TQ3RationalPoint4D        TQ3RationalPoint4D;
  365.  
  366. struct TQ3RationalPoint3D {
  367.     float                             x;
  368.     float                             y;
  369.     float                             w;
  370. };
  371. typedef struct TQ3RationalPoint3D        TQ3RationalPoint3D;
  372. /******************************************************************************
  373.  **                                                                             **
  374.  **                                Quaternion                                     **
  375.  **                                                                             **
  376.  *****************************************************************************/
  377.  
  378. struct TQ3Quaternion {
  379.     float                             w;
  380.     float                             x;
  381.     float                             y;
  382.     float                             z;
  383. };
  384. typedef struct TQ3Quaternion            TQ3Quaternion;
  385. /******************************************************************************
  386.  **                                                                             **
  387.  **                                Ray Definition                                 **
  388.  **                                                                             **
  389.  *****************************************************************************/
  390.  
  391. struct TQ3Ray3D {
  392.     TQ3Point3D                         origin;
  393.     TQ3Vector3D                     direction;
  394. };
  395. typedef struct TQ3Ray3D                    TQ3Ray3D;
  396. /******************************************************************************
  397.  **                                                                             **
  398.  **                        Parameterization Data Structures                     **
  399.  **                                                                             **
  400.  *****************************************************************************/
  401.  
  402. struct TQ3Param2D {
  403.     float                             u;
  404.     float                             v;
  405. };
  406. typedef struct TQ3Param2D                TQ3Param2D;
  407.  
  408. struct TQ3Param3D {
  409.     float                             u;
  410.     float                             v;
  411.     float                             w;
  412. };
  413. typedef struct TQ3Param3D                TQ3Param3D;
  414.  
  415. struct TQ3Tangent2D {
  416.     TQ3Vector3D                     uTangent;
  417.     TQ3Vector3D                     vTangent;
  418. };
  419. typedef struct TQ3Tangent2D                TQ3Tangent2D;
  420.  
  421. struct TQ3Tangent3D {
  422.     TQ3Vector3D                     uTangent;
  423.     TQ3Vector3D                     vTangent;
  424.     TQ3Vector3D                     wTangent;
  425. };
  426. typedef struct TQ3Tangent3D                TQ3Tangent3D;
  427. /******************************************************************************
  428.  **                                                                             **
  429.  **                        Polar and Spherical Coordinates                         **
  430.  **                                                                             **
  431.  *****************************************************************************/
  432.  
  433. struct TQ3PolarPoint {
  434.     float                             r;
  435.     float                             theta;
  436. };
  437. typedef struct TQ3PolarPoint            TQ3PolarPoint;
  438.  
  439. struct TQ3SphericalPoint {
  440.     float                             rho;
  441.     float                             theta;
  442.     float                             phi;
  443. };
  444. typedef struct TQ3SphericalPoint        TQ3SphericalPoint;
  445. /******************************************************************************
  446.  **                                                                             **
  447.  **                            Color Definition                                 **
  448.  **                                                                             **
  449.  *****************************************************************************/
  450.  
  451. struct TQ3ColorRGB {
  452.     float                             r;
  453.     float                             g;
  454.     float                             b;
  455. };
  456. typedef struct TQ3ColorRGB                TQ3ColorRGB;
  457.  
  458. struct TQ3ColorARGB {
  459.     float                             a;
  460.     float                             r;
  461.     float                             g;
  462.     float                             b;
  463. };
  464. typedef struct TQ3ColorARGB                TQ3ColorARGB;
  465. /******************************************************************************
  466.  **                                                                             **
  467.  **                                    Vertices                                 **
  468.  **                                                                             **
  469.  *****************************************************************************/
  470.  
  471. struct TQ3Vertex3D {
  472.     TQ3Point3D                         point;
  473.     TQ3AttributeSet                 attributeSet;
  474. };
  475. typedef struct TQ3Vertex3D                TQ3Vertex3D;
  476. /******************************************************************************
  477.  **                                                                             **
  478.  **                                    Matrices                                 **
  479.  **                                                                             **
  480.  *****************************************************************************/
  481.  
  482. struct TQ3Matrix3x3 {
  483.     float                             value[3][3];
  484. };
  485. typedef struct TQ3Matrix3x3                TQ3Matrix3x3;
  486.  
  487. struct TQ3Matrix4x4 {
  488.     float                             value[4][4];
  489. };
  490. typedef struct TQ3Matrix4x4                TQ3Matrix4x4;
  491. /******************************************************************************
  492.  **                                                                             **
  493.  **                                Bitmap/Pixmap                                 **
  494.  **                                                                             **
  495.  *****************************************************************************/
  496.  
  497. struct TQ3Pixmap {
  498.     void *                            image;
  499.     unsigned long                     width;
  500.     unsigned long                     height;
  501.     unsigned long                     rowBytes;
  502.     unsigned long                     pixelSize;                    /* MUST be 16 or 32 to use with the    Interactive Renderer on Mac OS*/
  503.     TQ3PixelType                     pixelType;
  504.     TQ3Endian                         bitOrder;
  505.     TQ3Endian                         byteOrder;
  506. };
  507. typedef struct TQ3Pixmap                TQ3Pixmap;
  508.  
  509. struct TQ3StoragePixmap {
  510.     TQ3StorageObject                 image;
  511.     unsigned long                     width;
  512.     unsigned long                     height;
  513.     unsigned long                     rowBytes;
  514.     unsigned long                     pixelSize;                    /* MUST be 16 or 32 to use with the    Interactive Renderer on Mac OS*/
  515.     TQ3PixelType                     pixelType;
  516.     TQ3Endian                         bitOrder;
  517.     TQ3Endian                         byteOrder;
  518. };
  519. typedef struct TQ3StoragePixmap            TQ3StoragePixmap;
  520.  
  521. struct TQ3Bitmap {
  522.     unsigned char *                    image;
  523.     unsigned long                     width;
  524.     unsigned long                     height;
  525.     unsigned long                     rowBytes;
  526.     TQ3Endian                         bitOrder;
  527. };
  528. typedef struct TQ3Bitmap                TQ3Bitmap;
  529.  
  530. struct TQ3MipmapImage {                                            /* An image for use as a texture mipmap  */
  531.     unsigned long                     width;                        /* Width of mipmap, must be power of 2   */
  532.     unsigned long                     height;                        /* Height of mipmap, must be power of 2  */
  533.     unsigned long                     rowBytes;                    /* Rowbytes of mipmap                    */
  534.     unsigned long                     offset;                        /* Offset from image base to this mipmap */
  535. };
  536. typedef struct TQ3MipmapImage            TQ3MipmapImage;
  537.  
  538. struct TQ3Mipmap {
  539.     TQ3StorageObject                 image;                        /* Data containing the texture map and     */
  540.                                                                 /* if (useMipmapping==kQ3True) the         */
  541.                                                                 /* mipmap data                             */
  542.     TQ3Boolean                         useMipmapping;                /* True if mipmapping should be used     */
  543.                                                                 /* and all mipmaps have been provided   */
  544.     TQ3PixelType                     pixelType;
  545.     TQ3Endian                         bitOrder;
  546.     TQ3Endian                         byteOrder;
  547.     unsigned long                     reserved;                    /* leave NULL for next version */
  548.     TQ3MipmapImage                     mipmaps[32];                /* The actual number of mipmaps is         */
  549.                                                                 /* determined from the size of the         */
  550.                                                                 /* first mipmap                            */
  551. };
  552. typedef struct TQ3Mipmap                TQ3Mipmap;
  553.  
  554. /******************************************************************************
  555.  **                                                                             **
  556.  **                        Higher dimension quantities                             **
  557.  **                                                                             **
  558.  *****************************************************************************/
  559.  
  560. struct TQ3Area {
  561.     TQ3Point2D                         min;
  562.     TQ3Point2D                         max;
  563. };
  564. typedef struct TQ3Area                    TQ3Area;
  565.  
  566. struct TQ3PlaneEquation {
  567.     TQ3Vector3D                     normal;
  568.     float                             constant;
  569. };
  570. typedef struct TQ3PlaneEquation            TQ3PlaneEquation;
  571.  
  572. struct TQ3BoundingBox {
  573.     TQ3Point3D                         min;
  574.     TQ3Point3D                         max;
  575.     TQ3Boolean                         isEmpty;
  576. };
  577. typedef struct TQ3BoundingBox            TQ3BoundingBox;
  578.  
  579. struct TQ3BoundingSphere {
  580.     TQ3Point3D                         origin;
  581.     float                             radius;
  582.     TQ3Boolean                         isEmpty;
  583. };
  584. typedef struct TQ3BoundingSphere        TQ3BoundingSphere;
  585. /*
  586.  *    The TQ3ComputeBounds flag passed to StartBoundingBox or StartBoundingSphere
  587.  *    calls in the View. It's a hint to the system as to how it should 
  588.  *    compute the bbox of a shape:
  589.  *
  590.  *    kQ3ComputeBoundsExact:    
  591.  *        Vertices of shapes are transformed into world space and
  592.  *        the world space bounding box is computed from them.  Slow!
  593.  *    
  594.  *    kQ3ComputeBoundsApproximate: 
  595.  *        A local space bounding box is computed from a shape's
  596.  *        vertices.  This bbox is then transformed into world space,
  597.  *        and its bounding box is taken as the shape's approximate
  598.  *        bbox.  Fast but the bbox is larger than optimal.
  599.  */
  600.  
  601. enum TQ3ComputeBounds {
  602.     kQ3ComputeBoundsExact        = 0,
  603.     kQ3ComputeBoundsApproximate    = 1
  604. };
  605. typedef enum TQ3ComputeBounds TQ3ComputeBounds;
  606.  
  607.  
  608. /******************************************************************************
  609.  **                                                                             **
  610.  **                            Object System Types                                 **
  611.  **                                                                             **
  612.  *****************************************************************************/
  613. typedef struct OpaqueTQ3XObjectClass*     TQ3XObjectClass;
  614.  
  615. typedef unsigned long                     TQ3XMethodType;
  616. /*
  617.  * Object methods
  618.  */
  619. #define kQ3XMethodTypeObjectUnregister        Q3_METHOD_TYPE('u','n','r','g')
  620. #define kQ3XMethodTypeObjectIsDrawable        Q3_METHOD_TYPE('i','s','d','r')    /* return true from the metahandler if this object can be submitted in a rendering loop */
  621. typedef CALLBACK_API_C( void , TQ3XFunctionPointer )(void );
  622. typedef CALLBACK_API_C( TQ3XFunctionPointer , TQ3XMetaHandler )(TQ3XMethodType methodType);
  623. /*
  624.  * MetaHandler:
  625.  *        When you give a metahandler to QuickDraw 3D, it is called multiple 
  626.  *        times to build method tables, and then is thrown away. You are 
  627.  *        guaranteed that your metahandler will never be called again after a 
  628.  *        call that was passed a metahandler returns.
  629.  *
  630.  *        Your metahandler should contain a switch on the methodType passed to it
  631.  *        and should return the corresponding method as an TQ3XFunctionPointer.
  632.  *
  633.  *        IMPORTANT: A metaHandler MUST always "return" a value. If you are
  634.  *        passed a methodType that you do not understand, ALWAYS return NULL.
  635.  *
  636.  *        These types here are prototypes of how your functions should look.
  637.  */
  638. typedef CALLBACK_API_C( TQ3Status , TQ3XObjectUnregisterMethod )(TQ3XObjectClass objectClass);
  639. /*
  640.  * See QD3DIO.h for the IO method types: 
  641.  *        ObjectReadData, ObjectTraverse, ObjectWrite
  642.  */
  643.  
  644. /******************************************************************************
  645.  **                                                                             **
  646.  **                                Set Types                                     **
  647.  **                                                                             **
  648.  *****************************************************************************/
  649. typedef long                             TQ3ElementType;
  650.  
  651. #define kQ3ElementTypeNone        0
  652. #define kQ3ElementTypeUnknown    32
  653. #define kQ3ElementTypeSet        33
  654.  
  655. /* 
  656.  *    kQ3ElementTypeUnknown is a TQ3Object. 
  657.  *    
  658.  *        Do Q3Set_Add(s, ..., &obj) or Q3Set_Get(s, ..., &obj);
  659.  *        
  660.  *        Note that the object is always referenced when copying around. 
  661.  *        
  662.  *        Generally, it is an Unknown object, a Group of Unknown objects, or a 
  663.  *        group of other "objects" which have been found in the metafile and
  664.  *        have no attachment method to their parent. Be prepared to handle
  665.  *        any or all of these cases if you actually access the set on a shape.
  666.  *
  667.  *    kQ3ElementTypeSet is a TQ3SetObject. 
  668.  *    
  669.  *        Q3Shape_GetSet(s,&o) is eqivalent to 
  670.  *            Q3Shape_GetElement(s, kQ3ElementTypeSet, &o)
  671.  *            
  672.  *        Q3Shape_SetSet(s,o)  is eqivalent to 
  673.  *            Q3Shape_SetElement(s, kQ3ElementTypeSet, &o)
  674.  *    
  675.  *        Note that the object is always referenced when copying around. 
  676.  *        
  677.  *    See the note below about the Set and Shape changes.
  678.  */
  679.  
  680. /******************************************************************************
  681.  **                                                                             **
  682.  **                            Object System Macros                             **
  683.  **                                                                             **
  684.  *****************************************************************************/
  685.  
  686. #define Q3_FOUR_CHARACTER_CONSTANT(a,b,c,d)         \
  687.             ((const unsigned long)                     \
  688.             ((const unsigned long) (a) << 24) |     \
  689.             ((const unsigned long) (b) << 16) |        \
  690.             ((const unsigned long) (c) << 8)  |     \
  691.             ((const unsigned long) (d)))
  692.  
  693. #define Q3_OBJECT_TYPE(a,b,c,d) \
  694.     ((TQ3ObjectType) Q3_FOUR_CHARACTER_CONSTANT(a,b,c,d))
  695.  
  696. #define Q3_METHOD_TYPE(a,b,c,d) \
  697.     ((TQ3XMethodType) Q3_FOUR_CHARACTER_CONSTANT(a,b,c,d))
  698.  
  699. /******************************************************************************
  700.  **                                                                             **
  701.  **                                Object Types                                 **
  702.  **                                                                             **
  703.  *****************************************************************************/
  704. /*
  705.  * Note:    a call to Q3Foo_GetType will return a value kQ3FooTypeBar
  706.  *            e.g. Q3Shared_GetType(object) returns kQ3SharedTypeShape, etc.
  707.  */
  708.  
  709. #define kQ3ObjectTypeInvalid                            0L
  710. #define kQ3ObjectTypeView                                ((TQ3ObjectType)FOUR_CHAR_CODE('view'))
  711. #define kQ3ObjectTypeElement                            ((TQ3ObjectType)FOUR_CHAR_CODE('elmn'))
  712.     #define kQ3ElementTypeAttribute                        ((TQ3ObjectType)FOUR_CHAR_CODE('eatt'))
  713. #define kQ3ObjectTypePick                                ((TQ3ObjectType)FOUR_CHAR_CODE('pick'))
  714.     #define kQ3PickTypeWindowPoint                        ((TQ3ObjectType)FOUR_CHAR_CODE('pkwp'))
  715.     #define kQ3PickTypeWindowRect                        ((TQ3ObjectType)FOUR_CHAR_CODE('pkwr'))
  716. #define kQ3ObjectTypeShared                                ((TQ3ObjectType)FOUR_CHAR_CODE('shrd'))
  717.     #define kQ3SharedTypeRenderer                        ((TQ3ObjectType)FOUR_CHAR_CODE('rddr'))
  718.         #define kQ3RendererTypeWireFrame                ((TQ3ObjectType)FOUR_CHAR_CODE('wrfr'))
  719.         #define kQ3RendererTypeGeneric                    ((TQ3ObjectType)FOUR_CHAR_CODE('gnrr'))
  720.         #define kQ3RendererTypeInteractive                ((TQ3ObjectType)FOUR_CHAR_CODE('ctwn'))
  721.     #define kQ3SharedTypeShape                            ((TQ3ObjectType)FOUR_CHAR_CODE('shap'))
  722.  
  723.             
  724.         #define kQ3ShapeTypeGeometry                    ((TQ3ObjectType)FOUR_CHAR_CODE('gmtr'))
  725.             #define kQ3GeometryTypeBox                    ((TQ3ObjectType)FOUR_CHAR_CODE('box '))
  726.             #define kQ3GeometryTypeGeneralPolygon        ((TQ3ObjectType)FOUR_CHAR_CODE('gpgn'))
  727.             #define kQ3GeometryTypeLine                    ((TQ3ObjectType)FOUR_CHAR_CODE('line'))
  728.             #define kQ3GeometryTypeMarker                ((TQ3ObjectType)FOUR_CHAR_CODE('mrkr'))
  729.             #define kQ3GeometryTypePixmapMarker            ((TQ3ObjectType)FOUR_CHAR_CODE('mrkp'))
  730.             #define kQ3GeometryTypeMesh                    ((TQ3ObjectType)FOUR_CHAR_CODE('mesh'))
  731.             #define kQ3GeometryTypeNURBCurve            ((TQ3ObjectType)FOUR_CHAR_CODE('nrbc'))
  732.             #define kQ3GeometryTypeNURBPatch            ((TQ3ObjectType)FOUR_CHAR_CODE('nrbp'))
  733.             #define kQ3GeometryTypePoint                ((TQ3ObjectType)FOUR_CHAR_CODE('pnt '))
  734.             #define kQ3GeometryTypePolygon                ((TQ3ObjectType)FOUR_CHAR_CODE('plyg'))
  735.             #define kQ3GeometryTypePolyLine                ((TQ3ObjectType)FOUR_CHAR_CODE('plyl'))
  736.             #define kQ3GeometryTypeTriangle                ((TQ3ObjectType)FOUR_CHAR_CODE('trng'))
  737.             #define kQ3GeometryTypeTriGrid                ((TQ3ObjectType)FOUR_CHAR_CODE('trig'))
  738.             #define kQ3GeometryTypeCone                    ((TQ3ObjectType)FOUR_CHAR_CODE('cone'))
  739.             #define kQ3GeometryTypeCylinder                ((TQ3ObjectType)FOUR_CHAR_CODE('cyln'))
  740.             #define kQ3GeometryTypeDisk                    ((TQ3ObjectType)FOUR_CHAR_CODE('disk'))
  741.             #define kQ3GeometryTypeEllipse                ((TQ3ObjectType)FOUR_CHAR_CODE('elps'))
  742.             #define kQ3GeometryTypeEllipsoid            ((TQ3ObjectType)FOUR_CHAR_CODE('elpd'))
  743.             #define kQ3GeometryTypePolyhedron            ((TQ3ObjectType)FOUR_CHAR_CODE('plhd'))
  744.             #define kQ3GeometryTypeTorus                ((TQ3ObjectType)FOUR_CHAR_CODE('tors'))
  745.             #define kQ3GeometryTypeTriMesh                ((TQ3ObjectType)FOUR_CHAR_CODE('tmsh'))
  746.  
  747.             
  748.         #define kQ3ShapeTypeShader                        ((TQ3ObjectType)FOUR_CHAR_CODE('shdr'))
  749.             #define kQ3ShaderTypeSurface                ((TQ3ObjectType)FOUR_CHAR_CODE('sush'))
  750.                 #define kQ3SurfaceShaderTypeTexture        ((TQ3ObjectType)FOUR_CHAR_CODE('txsu'))
  751.             #define kQ3ShaderTypeIllumination            ((TQ3ObjectType)FOUR_CHAR_CODE('ilsh'))
  752.                 #define kQ3IlluminationTypePhong        ((TQ3ObjectType)FOUR_CHAR_CODE('phil'))
  753.                 #define kQ3IlluminationTypeLambert        ((TQ3ObjectType)FOUR_CHAR_CODE('lmil'))
  754.                 #define kQ3IlluminationTypeNULL            ((TQ3ObjectType)FOUR_CHAR_CODE('nuil'))
  755.         #define kQ3ShapeTypeStyle                        ((TQ3ObjectType)FOUR_CHAR_CODE('styl'))
  756.             #define kQ3StyleTypeBackfacing                ((TQ3ObjectType)FOUR_CHAR_CODE('bckf'))
  757.             #define kQ3StyleTypeInterpolation            ((TQ3ObjectType)FOUR_CHAR_CODE('intp'))
  758.             #define kQ3StyleTypeFill                    ((TQ3ObjectType)FOUR_CHAR_CODE('fist'))
  759.             #define kQ3StyleTypePickID                    ((TQ3ObjectType)FOUR_CHAR_CODE('pkid'))
  760.             #define kQ3StyleTypeReceiveShadows            ((TQ3ObjectType)FOUR_CHAR_CODE('rcsh'))
  761.             #define kQ3StyleTypeHighlight                ((TQ3ObjectType)FOUR_CHAR_CODE('high'))
  762.             #define kQ3StyleTypeSubdivision                ((TQ3ObjectType)FOUR_CHAR_CODE('sbdv'))
  763.             #define kQ3StyleTypeOrientation                ((TQ3ObjectType)FOUR_CHAR_CODE('ofdr'))
  764.             #define kQ3StyleTypePickParts                ((TQ3ObjectType)FOUR_CHAR_CODE('pkpt'))
  765.             #define kQ3StyleTypeAntiAlias                ((TQ3ObjectType)FOUR_CHAR_CODE('anti'))
  766.  
  767.             
  768.         #define kQ3ShapeTypeTransform                    ((TQ3ObjectType)FOUR_CHAR_CODE('xfrm'))
  769.             #define kQ3TransformTypeMatrix                ((TQ3ObjectType)FOUR_CHAR_CODE('mtrx'))
  770.             #define kQ3TransformTypeScale                ((TQ3ObjectType)FOUR_CHAR_CODE('scal'))
  771.             #define kQ3TransformTypeTranslate            ((TQ3ObjectType)FOUR_CHAR_CODE('trns'))
  772.             #define kQ3TransformTypeRotate                ((TQ3ObjectType)FOUR_CHAR_CODE('rott'))
  773.             #define kQ3TransformTypeRotateAboutPoint     ((TQ3ObjectType)FOUR_CHAR_CODE('rtap'))
  774.             #define kQ3TransformTypeRotateAboutAxis     ((TQ3ObjectType)FOUR_CHAR_CODE('rtaa'))
  775.             #define kQ3TransformTypeQuaternion            ((TQ3ObjectType)FOUR_CHAR_CODE('qtrn'))
  776.             #define kQ3TransformTypeReset                ((TQ3ObjectType)FOUR_CHAR_CODE('rset'))
  777.         #define kQ3ShapeTypeLight                        ((TQ3ObjectType)FOUR_CHAR_CODE('lght'))
  778.             #define kQ3LightTypeAmbient                    ((TQ3ObjectType)FOUR_CHAR_CODE('ambn'))
  779.             #define kQ3LightTypeDirectional                ((TQ3ObjectType)FOUR_CHAR_CODE('drct'))
  780.             #define kQ3LightTypePoint                    ((TQ3ObjectType)FOUR_CHAR_CODE('pntl'))
  781.             #define kQ3LightTypeSpot                    ((TQ3ObjectType)FOUR_CHAR_CODE('spot'))
  782.         #define kQ3ShapeTypeCamera                        ((TQ3ObjectType)FOUR_CHAR_CODE('cmra'))
  783.             #define kQ3CameraTypeOrthographic            ((TQ3ObjectType)FOUR_CHAR_CODE('orth'))
  784.             #define kQ3CameraTypeViewPlane                ((TQ3ObjectType)FOUR_CHAR_CODE('vwpl'))
  785.             #define kQ3CameraTypeViewAngleAspect        ((TQ3ObjectType)FOUR_CHAR_CODE('vana'))
  786.         #define kQ3ShapeTypeGroup                        ((TQ3ObjectType)FOUR_CHAR_CODE('grup'))
  787.             #define kQ3GroupTypeDisplay                    ((TQ3ObjectType)FOUR_CHAR_CODE('dspg'))
  788.                 #define kQ3DisplayGroupTypeOrdered        ((TQ3ObjectType)FOUR_CHAR_CODE('ordg'))
  789.                 #define kQ3DisplayGroupTypeIOProxy        ((TQ3ObjectType)FOUR_CHAR_CODE('iopx'))
  790.             #define kQ3GroupTypeLight                    ((TQ3ObjectType)FOUR_CHAR_CODE('lghg'))
  791.             #define kQ3GroupTypeInfo                    ((TQ3ObjectType)FOUR_CHAR_CODE('info'))
  792.  
  793.             
  794.         #define kQ3ShapeTypeUnknown                        ((TQ3ObjectType)FOUR_CHAR_CODE('unkn'))
  795.             #define kQ3UnknownTypeText                    ((TQ3ObjectType)FOUR_CHAR_CODE('uktx'))
  796.             #define kQ3UnknownTypeBinary                ((TQ3ObjectType)FOUR_CHAR_CODE('ukbn'))
  797.         #define kQ3ShapeTypeReference                    ((TQ3ObjectType)FOUR_CHAR_CODE('rfrn'))
  798.             #define kQ3ReferenceTypeExternal            ((TQ3ObjectType)FOUR_CHAR_CODE('rfex'))
  799.     #define kQ3SharedTypeSet                            ((TQ3ObjectType)FOUR_CHAR_CODE('set '))
  800.         #define kQ3SetTypeAttribute                        ((TQ3ObjectType)FOUR_CHAR_CODE('attr'))
  801.     #define kQ3SharedTypeDrawContext                    ((TQ3ObjectType)FOUR_CHAR_CODE('dctx'))
  802.         #define kQ3DrawContextTypePixmap                ((TQ3ObjectType)FOUR_CHAR_CODE('dpxp'))
  803.         #define kQ3DrawContextTypeMacintosh                ((TQ3ObjectType)FOUR_CHAR_CODE('dmac'))
  804.         #define kQ3DrawContextTypeWin32DC                ((TQ3ObjectType)FOUR_CHAR_CODE('dw32'))
  805.         #define kQ3DrawContextTypeDDSurface                ((TQ3ObjectType)FOUR_CHAR_CODE('ddds'))
  806.         #define kQ3DrawContextTypeX11                    ((TQ3ObjectType)FOUR_CHAR_CODE('dx11'))
  807.     #define kQ3SharedTypeTexture                        ((TQ3ObjectType)FOUR_CHAR_CODE('txtr'))
  808.         #define kQ3TextureTypePixmap                    ((TQ3ObjectType)FOUR_CHAR_CODE('txpm'))    
  809.         #define kQ3TextureTypeMipmap                    ((TQ3ObjectType)FOUR_CHAR_CODE('txmm'))    
  810.  
  811.             
  812.     #define kQ3SharedTypeFile                            ((TQ3ObjectType)FOUR_CHAR_CODE('file'))
  813.     #define kQ3SharedTypeStorage                        ((TQ3ObjectType)FOUR_CHAR_CODE('strg'))
  814.         #define kQ3StorageTypeMemory                    ((TQ3ObjectType)FOUR_CHAR_CODE('mems'))
  815.         #define kQ3MemoryStorageTypeHandle                ((TQ3ObjectType)FOUR_CHAR_CODE('hndl'))
  816.         #define kQ3StorageTypeUnix                        ((TQ3ObjectType)FOUR_CHAR_CODE('uxst'))
  817.         #define kQ3UnixStorageTypePath                    ((TQ3ObjectType)FOUR_CHAR_CODE('unix'))
  818.         #define kQ3StorageTypeMacintosh                    ((TQ3ObjectType)FOUR_CHAR_CODE('macn'))
  819.         #define kQ3MacintoshStorageTypeFSSpec            ((TQ3ObjectType)FOUR_CHAR_CODE('macp'))                    
  820.         #define kQ3StorageTypeWin32                        ((TQ3ObjectType)FOUR_CHAR_CODE('wist'))
  821.     #define kQ3SharedTypeString                            ((TQ3ObjectType)FOUR_CHAR_CODE('strn'))
  822.         #define kQ3StringTypeCString                    ((TQ3ObjectType)FOUR_CHAR_CODE('strc'))
  823.     #define kQ3SharedTypeShapePart                        ((TQ3ObjectType)FOUR_CHAR_CODE('sprt'))
  824.         #define kQ3ShapePartTypeMeshPart                ((TQ3ObjectType)FOUR_CHAR_CODE('spmh'))
  825.             #define kQ3MeshPartTypeMeshFacePart            ((TQ3ObjectType)FOUR_CHAR_CODE('mfac'))
  826.             #define kQ3MeshPartTypeMeshEdgePart            ((TQ3ObjectType)FOUR_CHAR_CODE('medg'))
  827.             #define kQ3MeshPartTypeMeshVertexPart        ((TQ3ObjectType)FOUR_CHAR_CODE('mvtx'))
  828.     #define kQ3SharedTypeControllerState                ((TQ3ObjectType)FOUR_CHAR_CODE('ctst'))
  829.     #define kQ3SharedTypeTracker                        ((TQ3ObjectType)FOUR_CHAR_CODE('trkr'))
  830.     #define kQ3SharedTypeViewHints                        ((TQ3ObjectType)FOUR_CHAR_CODE('vwhn'))
  831.     #define kQ3SharedTypeEndGroup                        ((TQ3ObjectType)FOUR_CHAR_CODE('endg'))
  832.  
  833. /******************************************************************************
  834.  **                                                                             **
  835.  **                            QuickDraw 3D System Routines                     **
  836.  **                                                                             **
  837.  *****************************************************************************/
  838. EXTERN_API_C( TQ3Status )
  839. Q3Initialize                    (void);
  840.  
  841. EXTERN_API_C( TQ3Status )
  842. Q3Exit                            (void);
  843.  
  844. EXTERN_API_C( TQ3Boolean )
  845. Q3IsInitialized                    (void);
  846.  
  847. EXTERN_API_C( TQ3Status )
  848. Q3GetVersion                    (unsigned long *        majorRevision,
  849.                                  unsigned long *        minorRevision);
  850.  
  851. /*
  852.  *  Q3GetReleaseVersion returns the release version number,
  853.  *  in the format of the first four bytes of a 'vers' resource
  854.  *  (e.g. 0x01518000 ==> 1.5.1 release).
  855.  */
  856. EXTERN_API_C( TQ3Status )
  857. Q3GetReleaseVersion                (unsigned long *        releaseRevision);
  858.  
  859.  
  860. /******************************************************************************
  861.  **                                                                             **
  862.  **                            ObjectClass Routines                             **
  863.  **                                                                             **
  864.  *****************************************************************************/
  865. /* 
  866.  *  New object system calls to query the object system.
  867.  *
  868.  *  These comments to move to the stubs file before final release, they 
  869.  *  are here for documentation for developers using early seeds.
  870.  */
  871. /*
  872.  *  Given a class name as a string return the associated class type for the 
  873.  *  class, may return kQ3Failure if the string representing the class is 
  874.  *  invalid.
  875.  */
  876. EXTERN_API_C( TQ3Status )
  877. Q3ObjectHierarchy_GetTypeFromString (TQ3ObjectClassNameString  objectClassString,
  878.                                  TQ3ObjectType *        objectClassType);
  879.  
  880. /*
  881.  *  Given a class type as return the associated string for the class name, 
  882.  *  may return kQ3Failure if the type representing the class is invalid.
  883.  */
  884. EXTERN_API_C( TQ3Status )
  885. Q3ObjectHierarchy_GetStringFromType (TQ3ObjectType         objectClassType,
  886.                                  TQ3ObjectClassNameString  objectClassString);
  887.  
  888. /* 
  889.  *  Return true if the class with this type is registered, false if not 
  890.  */
  891. EXTERN_API_C( TQ3Boolean )
  892. Q3ObjectHierarchy_IsTypeRegistered (TQ3ObjectType         objectClassType);
  893.  
  894. /* 
  895.  *  Return true if the class with this name is registered, false if not 
  896.  */
  897. EXTERN_API_C( TQ3Boolean )
  898. Q3ObjectHierarchy_IsNameRegistered (const char *        objectClassName);
  899.  
  900. /*
  901.  * TQ3SubClassData is used when querying the object system for
  902.  * the subclasses of a particular parent type:
  903.  */
  904.  
  905. struct TQ3SubClassData {
  906.     unsigned long                     numClasses;                    /* the # of subclass types found for a parent class */
  907.     TQ3ObjectType *                    classTypes;                    /* an array containing the class types */
  908. };
  909. typedef struct TQ3SubClassData            TQ3SubClassData;
  910. /*
  911.  *  Given a parent type and an instance of the TQ3SubClassData struct fill
  912.  *  it in with the number and class types of all of the subclasses immediately
  913.  *  below the parent in the class hierarchy.  Return kQ3Success to indicate no
  914.  *  errors occurred, else kQ3Failure.
  915.  *
  916.  *  NOTE:  This function will allocate memory for the classTypes array.  Be 
  917.  *    sure to call Q3ObjectClass_EmptySubClassData to free this memory up.
  918.  */
  919. EXTERN_API_C( TQ3Status )
  920. Q3ObjectHierarchy_GetSubClassData (TQ3ObjectType         objectClassType,
  921.                                  TQ3SubClassData *        subClassData);
  922.  
  923. /*
  924.  *  Given an instance of the TQ3SubClassData struct free all memory allocated 
  925.  *    by the Q3ObjectClass_GetSubClassData call.
  926.  *
  927.  *  NOTE: This call MUST be made after a call to Q3ObjectClass_GetSubClassData
  928.  *  to avoid memory leaks.
  929.  */
  930. EXTERN_API_C( TQ3Status )
  931. Q3ObjectHierarchy_EmptySubClassData (TQ3SubClassData *    subClassData);
  932.  
  933.  
  934. /******************************************************************************
  935.  **                                                                             **
  936.  **                                Object Routines                                 **
  937.  **                                                                             **
  938.  *****************************************************************************/
  939. EXTERN_API_C( TQ3Status )
  940. Q3Object_Dispose                (TQ3Object                 object);
  941.  
  942. EXTERN_API_C( TQ3Object )
  943. Q3Object_Duplicate                (TQ3Object                 object);
  944.  
  945. EXTERN_API_C( TQ3Status )
  946. Q3Object_Submit                    (TQ3Object                 object,
  947.                                  TQ3ViewObject             view);
  948.  
  949. EXTERN_API_C( TQ3Boolean )
  950. Q3Object_IsDrawable                (TQ3Object                 object);
  951.  
  952. EXTERN_API_C( TQ3Boolean )
  953. Q3Object_IsWritable                (TQ3Object                 object,
  954.                                  TQ3FileObject             theFile);
  955.  
  956.  
  957. /******************************************************************************
  958.  **                                                                             **
  959.  **                            Object Type Routines                             **
  960.  **                                                                             **
  961.  *****************************************************************************/
  962. EXTERN_API_C( TQ3ObjectType )
  963. Q3Object_GetType                (TQ3Object                 object);
  964.  
  965. EXTERN_API_C( TQ3ObjectType )
  966. Q3Object_GetLeafType            (TQ3Object                 object);
  967.  
  968. EXTERN_API_C( TQ3Boolean )
  969. Q3Object_IsType                    (TQ3Object                 object,
  970.                                  TQ3ObjectType             theType);
  971.  
  972.  
  973. /******************************************************************************
  974.  **                                                                             **
  975.  **                            Shared Object Routines                             **
  976.  **                                                                             **
  977.  *****************************************************************************/
  978. EXTERN_API_C( TQ3ObjectType )
  979. Q3Shared_GetType                (TQ3SharedObject         sharedObject);
  980.  
  981. EXTERN_API_C( TQ3SharedObject )
  982. Q3Shared_GetReference            (TQ3SharedObject         sharedObject);
  983.  
  984. /* 
  985.  *    Q3Shared_IsReferenced
  986.  *        Returns kQ3True if there is more than one reference to sharedObject.
  987.  *        Returns kQ3False if there is ONE reference to sharedObject.
  988.  *    
  989.  *    This call is intended to allow applications and plug-in objects to delete
  990.  *    objects of which they hold THE ONLY REFERENCE. This is useful when
  991.  *    caching objects, etc.
  992.  *    
  993.  *    Although many may be tempted, DO NOT DO THIS:
  994.  *        while (Q3Shared_IsReferenced(foo)) { Q3Object_Dispose(foo); }
  995.  *    
  996.  *    Your application will crash and no one will buy it. Chapter 11 is 
  997.  *    never fun (unless you short the stock). Thanks.
  998.  */
  999. EXTERN_API_C( TQ3Boolean )
  1000. Q3Shared_IsReferenced            (TQ3SharedObject         sharedObject);
  1001.  
  1002. /*
  1003.  *    Q3Shared_GetEditIndex
  1004.  *        Returns the "serial number" of sharedObject. Usefuly for caching 
  1005.  *        object information. Returns 0 on error.
  1006.  *        
  1007.  *        Hold onto this number to determine if an object has changed since you
  1008.  *        last built your caches... To validate, do:
  1009.  *        
  1010.  *        if (Q3Shared_GetEditIndex(foo) == oldFooEditIndex) {
  1011.  *            // Cache is valid
  1012.  *        } else {
  1013.  *            // Cache is invalid
  1014.  *            RebuildSomeSortOfCache(foo);
  1015.  *            oldFooEditIndex = Q3Shared_GetEditIndex(foo);
  1016.  *        }
  1017.  */
  1018. EXTERN_API_C( unsigned long )
  1019. Q3Shared_GetEditIndex            (TQ3SharedObject         sharedObject);
  1020.  
  1021. /*
  1022.  *    Q3Shared_Edited
  1023.  *        Bumps the "serial number" of sharedObject to a different value. This
  1024.  *        call is intended to be used solely from a plug-in object which is 
  1025.  *        shared. Call this whenever your private instance data changes.
  1026.  *        
  1027.  *        Returns kQ3Failure iff sharedObject is not a shared object, OR
  1028.  *            QuickDraw 3D isn't initialized.
  1029.  */
  1030. EXTERN_API_C( TQ3Status )
  1031. Q3Shared_Edited                    (TQ3SharedObject         sharedObject);
  1032.  
  1033.  
  1034. /******************************************************************************
  1035.  **                                                                             **
  1036.  **                                Shape Routines                                 **
  1037.  **                                                                             **
  1038.  *****************************************************************************/
  1039. /*
  1040.  *    QuickDraw 3D 1.1 Note:
  1041.  *
  1042.  *    Shapes and Sets are now (sort of) polymorphic.
  1043.  *
  1044.  *        You may call Q3Shape_Foo or Q3Set_Foo on a shape or a set.
  1045.  *        The following calls are identical, in implementation:
  1046.  *
  1047.  *            Q3Shape_GetElement            =    Q3Set_Get
  1048.  *            Q3Shape_AddElement            =    Q3Set_Add
  1049.  *            Q3Shape_ContainsElement        =    Q3Set_Contains
  1050.  *            Q3Shape_GetNextElementType    =    Q3Set_GetNextElementType
  1051.  *            Q3Shape_EmptyElements        =    Q3Set_Empty
  1052.  *            Q3Shape_ClearElement        =    Q3Set_Clear
  1053.  *
  1054.  *    All of these calls accept a shape or a set as their first parameter.
  1055.  *
  1056.  *    The Q3Shape_GetSet and Q3ShapeSetSet calls are implemented via a new
  1057.  *    element type kQ3ElementTypeSet. See the note above about 
  1058.  *    kQ3ElementTypeSet;
  1059.  *
  1060.  *    It is important to note that the new Q3Shape_...Element... calls do not
  1061.  *    create a set on a shape and then add the element to it. This data is
  1062.  *    attached directly to the shape. Therefore, it is possible for an element
  1063.  *    to exist on a shape without a set existing on it as well. 
  1064.  *
  1065.  *    In your application, if you attach an element to a shape like this:
  1066.  *        (this isn't checking for errors for simplicity)
  1067.  *
  1068.  *        set = Q3Set_New();
  1069.  *        Q3Set_AddElement(set, kMyElemType, &data);
  1070.  *        Q3Shape_SetSet(shape, set);
  1071.  *
  1072.  *    You should retrieve it in the same manner:
  1073.  *
  1074.  *        Q3Shape_GetSet(shape, &set);
  1075.  *        if (Q3Set_Contains(set, kMyElemType) == kTrue) {
  1076.  *            Q3Set_Get(set, kMyElemType, &data);
  1077.  *        }
  1078.  *
  1079.  *    Similarly, if you attach data to a shape with the new calls:
  1080.  *
  1081.  *        Q3Shape_AddElement(shape, kMyElemType, &data);
  1082.  *
  1083.  *    You should retrieve it in the same manner:
  1084.  *
  1085.  *        if (Q3Shape_ContainsElement(set, kMyElemType) == kTrue) {
  1086.  *            Q3Shape_GetElement(set, kMyElemType, &data);
  1087.  *        }
  1088.  *
  1089.  *    This really becomes an issue when dealing with version 1.0 and version 1.1 
  1090.  *    metafiles.
  1091.  *
  1092.  *    When attempting to find a particular element on a shape, you should
  1093.  *    first check with Q3Shape_GetNextElementType or Q3Shape_GetElement, then,
  1094.  *    Q3Shape_GetSet(s, &set) (or Q3Shape_GetElement(s, kQ3ElementTypeSet, &set))
  1095.  *    and then Q3Shape_GetElement(set, ...).
  1096.  *
  1097.  *    In terms of implementation, Q3Shape_SetSet and Q3Shape_GetSet should only be
  1098.  *    used for sets of information that are shared among multiple shapes.
  1099.  *    
  1100.  *    Q3Shape_AddElement, Q3Shape_GetElement, etc. calls should only be used
  1101.  *    for elements that are unique for a particular shape.
  1102.  *    
  1103.  */
  1104. EXTERN_API_C( TQ3ObjectType )
  1105. Q3Shape_GetType                    (TQ3ShapeObject         shape);
  1106.  
  1107. EXTERN_API_C( TQ3Status )
  1108. Q3Shape_GetSet                    (TQ3ShapeObject         shape,
  1109.                                  TQ3SetObject *            theSet);
  1110.  
  1111. EXTERN_API_C( TQ3Status )
  1112. Q3Shape_SetSet                    (TQ3ShapeObject         shape,
  1113.                                  TQ3SetObject             theSet);
  1114.  
  1115. EXTERN_API_C( TQ3Status )
  1116. Q3Shape_AddElement                (TQ3ShapeObject         shape,
  1117.                                  TQ3ElementType         theType,
  1118.                                  const void *            data);
  1119.  
  1120. EXTERN_API_C( TQ3Status )
  1121. Q3Shape_GetElement                (TQ3ShapeObject         shape,
  1122.                                  TQ3ElementType         theType,
  1123.                                  void *                    data);
  1124.  
  1125. EXTERN_API_C( TQ3Boolean )
  1126. Q3Shape_ContainsElement            (TQ3ShapeObject         shape,
  1127.                                  TQ3ElementType         theType);
  1128.  
  1129. EXTERN_API_C( TQ3Status )
  1130. Q3Shape_GetNextElementType        (TQ3ShapeObject         shape,
  1131.                                  TQ3ElementType *        theType);
  1132.  
  1133. EXTERN_API_C( TQ3Status )
  1134. Q3Shape_EmptyElements            (TQ3ShapeObject         shape);
  1135.  
  1136. EXTERN_API_C( TQ3Status )
  1137. Q3Shape_ClearElement            (TQ3ShapeObject         shape,
  1138.                                  TQ3ElementType         theType);
  1139.  
  1140.  
  1141. /******************************************************************************
  1142.  **                                                                             **
  1143.  **                            Color Table Routines                             **
  1144.  **                                                                             **
  1145.  *****************************************************************************/
  1146. EXTERN_API_C( TQ3Status )
  1147. Q3Bitmap_Empty                    (TQ3Bitmap *            bitmap);
  1148.  
  1149. EXTERN_API_C( unsigned long )
  1150. Q3Bitmap_GetImageSize            (unsigned long             width,
  1151.                                  unsigned long             height);
  1152.  
  1153.  
  1154.  
  1155.  
  1156. #if PRAGMA_ENUM_ALWAYSINT
  1157.     #pragma enumsalwaysint reset
  1158. #elif PRAGMA_ENUM_OPTIONS
  1159.     #pragma option enum=reset
  1160. #elif defined(PRAGMA_ENUM_PACK__QD3D__)
  1161.     #pragma options(pack_enums)
  1162. #endif
  1163.  
  1164. #if PRAGMA_STRUCT_ALIGN
  1165.     #pragma options align=reset
  1166. #elif PRAGMA_STRUCT_PACKPUSH
  1167.     #pragma pack(pop)
  1168. #elif PRAGMA_STRUCT_PACK
  1169.     #pragma pack()
  1170. #endif
  1171.  
  1172. #ifdef PRAGMA_IMPORT_OFF
  1173. #pragma import off
  1174. #elif PRAGMA_IMPORT
  1175. #pragma import reset
  1176. #endif
  1177.  
  1178. #ifdef __cplusplus
  1179. }
  1180. #endif
  1181.  
  1182. #endif /* __QD3D__ */
  1183.  
  1184.